//
//  ArtistMVTableViewCell.m
//  花花时尚
//
//  Created by zhang on 15/10/7.
//  Copyright (c) 2015年 ggs. All rights reserved.
//

#import "ArtistMVTableViewCell.h"
#import "Define.h"
#import "VideoMode.h"
#import "ArtistModel.h"
#import "UIImageView+WebCache.h"

@interface ArtistMVTableViewCell ()
@property (nonatomic, retain)UIImageView *headPic;
@property (nonatomic, retain)UILabel *title;
@property (nonatomic, retain)UILabel *artist;
@property (nonatomic, retain)UILabel *totalViews;

@end

@implementation ArtistMVTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self creatView];
    }
    return self;
}
- (void)creatView
{
    self.headPic = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 150, 100)];
    self.headPic.backgroundColor = [UIColor blackColor];
    [self.contentView addSubview:self.headPic];
    [self.headPic release];
    
    self.title = [[UILabel alloc] initWithFrame:CGRectMake(self.headPic.frame.size.width + 5, 25, SCREEN_WIDTH - self.headPic.frame.size.width - 10, 15)];
    //    self.title.backgroundColor = [UIColor blackColor];
    self.title.textColor = [UIColor whiteColor];
    [self.contentView addSubview:self.title];
    [self.title release];
    
    self.artist = [[UILabel alloc] initWithFrame:CGRectMake(self.title.frame.origin.x, self.title.frame.origin.y + self.title.frame.size.height + 5, 80, self.title.frame.size.height)];
    //    self.artist.backgroundColor = [UIColor blackColor];
    self.artist.textColor = [UIColor whiteColor];
    [self.contentView addSubview:self.artist];
    [self.artist  release];
    
    self.totalViews = [[UILabel alloc] initWithFrame:CGRectMake(self.title.frame.origin.x, self.artist.frame.origin.y + self.artist.frame.size.height + 5, self.artist.frame.size.width, self.artist.frame.size.height)];
    //    self.totalViews.backgroundColor = [UIColor blackColor];
    self.totalViews.textColor = [UIColor whiteColor];
    [self.contentView addSubview:self.totalViews];
    [self.totalViews release];
}

- (void)setvalueWith:(VideoMode *)video artist:(ArtistModel *)artist
{
    [self.headPic sd_setImageWithURL:[NSURL URLWithString:video.posterPic] placeholderImage:[UIImage imageNamed:@"MV_holder.jpg"]];
    self.title.text = video.title;
    self.artist.text = artist.artistName;
    self.totalViews.text = [NSString stringWithFormat:@"%@", video.totalViews];
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
